<script>
const arr = [123,6,35,212,32]
const sum = arr.reduce(function(sum, n, index) {
  console.group(`index = ${index}`)
  console.log(`sum = ${sum}, n = ${n}`)
  const nextSum = sum + n
  console.log(`nextSum = ${nextSum}`)
  console.groupEnd()
  return nextSum
}, 0)
console.log(`sum = ${sum}`)

const arr2 = [1,2,3]
const newArr = []
arr2.forEach(function(n) {
  newArr.push(n*2)
})
console.log(newArr)
arr2.map(function(n) { return n*2})

</script>